//#include"Close_Hash.h"
//#include"OpenHash.h"
//#include"bitset.h"
//#include"hash_set.h"
//#include"hash_map.h"
//int main()
//{
//	//Close_Hash::test();
//	//OpenHash::test();
//	bit::unordered_map<int,int> s;
//	s.insert(make_pair(1, 1));
//	s.insert(make_pair(2,2));
//	s.insert(make_pair(11, 11));
//	s.insert(make_pair(12, 12));
//	s.insert(make_pair(13, 13));
//	s.insert(make_pair(11,11));
//	/*s.erase(s.find(1));
//	s.erase(s.find(2));
//	s.erase(s.find(11)); 
//	s.erase(s.find(13));
//	s.erase(s.find(12));
//	s.erase(s.find(1));*/
//
//}
#include<vector>
using namespace std;
class Solution {
public:
    int maxProfit(vector<int>& prices) {
        vector<int> tem(prices.size(), -1);
        int max = 0;
        for (int i = 1; i < tem.size(); i++)
        {
            if (prices[i] > prices[i - 1])
            {

                tem[i] = tem[i - 1] == -1 ? prices[i - 1] : tem[i - 1];
            }
            else
            {
                if (tem[i - 1] != -1 && tem[i - 1] < prices[i])
                    tem[i] = tem[i - 1];
                else
                    tem[i] = prices[i];
            }
            if(tem[i]!=-1&&prices[i]-tem[i]>max)
                max = prices[i] - tem[i];
        }

        return max;
    }
    int hIndex(vector<int>& citations) {
        if (citations.size() == 1)
        {
            if (citations[0] > 0)
                return 1;
            else
                return 0;
        }
        vector<int> v(citations.size(), 0);
        for (int i = 0; i < citations.size(); i++)
        {
            for (int j = 0; j < v.size(); j++)
            {
                if (citations[j] >= i)
                    v[i]++;
            }
        }
        for (int i = v.size() - 1; i >= 0; i--)
        {
            if (v[i] >= i)
                return v[i];
        }
        return 0;
    }
};

int main()
{
    Solution s;
    vector<int> tem({ 11,15 });
    s.hIndex(tem);
}